
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBJsonToModel/YBMineModel/YBMineZuZhiManagerModel.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBJsonToModel/YBMineModel/YBMineZuZhiNumberManagerModel.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBJsonToModel/YBMineModel/YBQuanCengHomeModel.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBNetWorkModule/YBBaseMineNetWork/YBBaseMineNetWork.dart';

class YBMineZuZhiManangerProvider with ChangeNotifier{

  
  YBMineZuZhiManangerModel zuZhiManangerModel;
  
  void getMineZuZhiManagerData(){
    YBMineNetWork.mineZuZhiManangerData({"sysCode":"xg_youbang"},success: (data){
      print("-组织-$data--");
      zuZhiManangerModel = YBMineZuZhiManangerModel.fromJson(data);
      notifyListeners();
    },fail: (error){
      print('----$error----');
    });
  }

}


class YBMineZuZhiNumberManagerProvider with ChangeNotifier {

  List<YBMineZuZhiNumberManagerModel> numberManagerList = List<YBMineZuZhiNumberManagerModel>();

  void getMineNumberManagerData(String orgCode){
    YBMineNetWork.mineZuZhiNumberManagerData({
      "sysCode":"xg_youbang",
      "orgCode":orgCode
    },success: (data){
      List dataList = data as List;
      if (!ObjectUtil.isEmptyList(dataList)) {
        print('--不易-$dataList--');
        numberManagerList.addAll(dataList.map((e){
          return YBMineZuZhiNumberManagerModel.fromJson(e);
        }).toList());
      }
      print("---$numberManagerList--");
      notifyListeners();
    },fail:(error){
      print("--$error-");
    });
  }

}


class YBMineQuanCengHomeProvider with ChangeNotifier{

  YBQuanCengHomeModel quanCengHomeModel;

  void getMineQuanCengHomeData(){
    YBMineNetWork.mineQuanCengHomeData({
      "sysCode":"xg_youbang",
    },success: (data){
      print("------object-$data--");
      quanCengHomeModel = YBQuanCengHomeModel.fromJson(data);
      notifyListeners();
    },fail: (error){
      print("----object--$error");
    });
  }

}
